#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

int ans,r,n;

inline int read(){
	int k=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())k=k*10+c-'0';
	return k*f;
}

class mp{
public:
	int x;
	int y;
	double l;
	double r; 
}p[2333];

bool cmp(mp a,mp b){
	return a.r<b.r;
}
int main(){
	freopen("ha14a.in","r",stdin);
	freopen("ha14a.out","w",stdout);
	n=read();
	r=read();
	for(int i=1;i<=n;i++){
		p[i].x=read();
		p[i].y=read();
		if(abs(p[i].y)>r){
			cout<<-1;
			return 0;
		}
	}
	
	for(int i=1;i<=n;i++){
		double fan=sqrt(pow(r,2)-pow(p[i].y,2));
		p[i].l=p[i].x-fan;
		p[i].r=p[i].x+fan;
	}
	sort(p+1,p+1+n,cmp);
//	for(int i=1;i<=n;i++){
//		printf("%d : left: %lf right: %lf\n",i,p[i].l,p[i].r);
//	}
	int k=1;
	ans=1;
//	int temp=p[k].r;
	for(int i=2;i<=n;i++){
		if(p[i].l<=p[k].r){
			continue;
		} 
		else {
			k=i;
			ans++;
		}
	}
	printf("%d",ans);
	return 0;
}










